package com.example.design.singleton;

public class Singleton {
	private static Singleton instance = null;
	
	private Singleton() {}
	
	/*多线程安全，在第一次创建时要加锁*/
	public static Singleton getInstance() {
		return SingletonHolder.instance;
	}
	
	/* 此处使用一个内部类来维护单例 */  
	private static class SingletonHolder {
		private static Singleton instance = new Singleton();
	}
	
	public Object readerResolver() {
		return instance;
	}
	
}
